package dac.web.interceptor;

//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.stereotype.Component;
//
//import com.ijpay.wxpay.WxPayApiConfig;
//import com.ijpay.wxpay.WxPayApiConfigKit;
//
//import dac.account.domain.WxPayBean;
//
//@Component
//public class ApplicationRunnerImpl implements ApplicationRunner {
//
//	
//	@Autowired
//    WxPayBean wxPayBean;
//	
//	@Override
//    public void run(ApplicationArguments args) throws Exception {
//        WxPayApiConfigKit.setThreadLocalWxPayApiConfig(this.getWxPayApiConfig());
//        System.out.println("=========================");
//        System.out.println("|微信，支付参数初始化完成|");
//        System.out.println("=========================");
//	}
//	
//	  public WxPayApiConfig getWxPayApiConfig() {
//	      WxPayApiConfig apiConfig;
//
//	      try {
//	          apiConfig = WxPayApiConfigKit.getApiConfig(wxPayBean.getAppId());
//	      } catch (Exception e) {
//	          apiConfig = WxPayApiConfig.builder()
//	                  .appId(wxPayBean.getAppId())
//	                  .mchId(wxPayBean.getMchId())
//	                  .partnerKey(wxPayBean.getPartnerKey())
//	                  .certPath(wxPayBean.getCertPath())
//	                  .domain(wxPayBean.getDomain())
//	                  .build();
//	      }
//	      wxPayBean.setNotifyUrl(apiConfig.getDomain().concat(wxPayBean.getNotifyUrl()));
//	      wxPayBean.setRefundNotifyUrl(apiConfig.getDomain().concat(wxPayBean.getRefundNotifyUrl()));
//	      return apiConfig;
//	  }
//
//}
